July 12, 2008 will

Food File on Ubuntu

Since I've moved to Linux as my primary desktop (I know, about time), I've been motivated in porting some of my old software. This shouldn't be too difficult, since I try to work in as platform agnostic manner as possible, and when I do use a platform specific API I keep it nice and modular. Food File is probably the most popular app I ever created, although only since I made it free. As a commercial app, it didn't do to well, probably because it didn't get noticed amongst all the diet / food applications for Windows out there, or possibly because I am lousy at marketing.

Food File on linux seems like a good fit, because it is a free wxPython interface to a publicly available data source (USDA Nutrient Database). I was hoping it would run without modification, but it failed on a line that used Windows-style back-slashes in paths rather than forward slashses -- as prefered by linux. After changing 4 such lines, it ran. I was surprised that the fancy OpenGL graphics didn't cause any problems, but it did segfault on the About box, the simplest dialog in the entire app (go figure). I haven't got to the bottom of that yet, but when I do, I will release a Linux version. Here's a screenshot of Food File running under Ubuntu:

Screenshot

I don't have any experience building a Linux package. If the lazyweb would like to help me with that, it would be appreciated!

I think it was this project that started my pie chart fetish. I wonder if there is a support group or something...

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
gravatar
Steve

So now you know why os.path.join is there, and why you should use it!

gravatar
Nick Moffitt

If you're interested in seeing your app packaged in Ubuntu, your best bet is probably to just do the python distutils stuff as normal and then talk to some Debian developers about getting it into Debian. Ubuntu syncs off of Debian at least twice a year, and they'll do all of the packaging work for you.

If you poke a developer who uses Launchpad PPAs (or makes repositories using native tools), it is also possible that a temporary repository can be set up to provide packages for folks who want to experiment before the Ubuntu release cycle has run its six-month course.

gravatar
Peter

Theres a showmedo video of how to package a Python program for Debian/Ubuntu
http://showmedo.com/videos/video?name=linuxJensMakingDeb

gravatar
fdgdfg

The button order is reversed though.

gravatar
keith

to fix the segfault change this :
class DialogAbout(wx.Dialog):



def __init__(self):

p = wx.PreDialog()
self.PostCreate(p)



self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)

self.Bind(wx.EVT_CLOSE, self.OnClose)

self.Bind(wx.EVT_INIT_DIALOG, self.OnInitDialog)



self.ctrl = CtrlLookup(self)



self.CentreOnParent()

to this:

class DialogAbout(wx.Dialog):



def __init__(self):

p = wx.PreDialog()


self.Bind(wx.EVT_BUTTON, self.OnOK, id=wx.ID_OK)

self.Bind(wx.EVT_CLOSE, self.OnClose)

self.Bind(wx.EVT_INIT_DIALOG, self.OnInitDialog)



self.ctrl = CtrlLookup(self)



self.CentreOnParent()
self.PostCreate(p)

You still get an error, which I haven't looked into yet, but no segfault.
See a screen shot of it at
http://keithperkins.net/files2/Screenshot.png

gravatar
keith

I forgot to mention that once you close the error box, the about dialog does open up.

gravatar
Jerry

FYI, foodfileonline.com is no longer working...

gravatar
Will

Steve, noted. Although something that has always bothered me about os.path.join is that if you join a Windoze path with backslashes with a path with forward slashes, it doesn't normalize the path separators. And Windows sometimes doesn't like paths with mixed separators. Its a simple fix , but if os.path.join did it for me, it would be one less thing to worry about!

Nick, Peter, thanks for the tips!

fdgdfg, what buttons?

Keith, thanks for the debugging!